package com.info33.platform.business.app.controller;

import com.info33.platform.business.app.entity.AppRoleUser;
import com.info33.platform.business.app.service.AppRoleUserService;
import com.info33.platform.common.mvc.controller.BaseController;
import com.info33.platform.common.mvc.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author admin
 */
@RestController
@RequestMapping("/AppRoleUser")
@Api(tags = "app - 用户角色关联")
public class AppRoleUserController extends BaseController<AppRoleUserService, AppRoleUser> {

    private final AppRoleUserService appRoleUserService;

    @Autowired
    public AppRoleUserController(AppRoleUserService appRoleUserService) {
        super(appRoleUserService);
        this.appRoleUserService = appRoleUserService;
    }

    @PatchMapping(value = "/app/switch/{id}")
    @ApiOperation(value = "app - 切换主要角色", notes = "app - 我所拥有的角色：roleUserVo 对象 id")
    public Result<Object> appSwitch(
            @PathVariable(value = "id") Long id) {
        return appRoleUserService.appSwitch(id, getCurrentUser());
    }

}